home *** CD-ROM | disk | FTP | other *** search
/ CICA 1993 April / CICA MS Windows - April 1993.iso / unzipped / misc / iv26_w30 / intervie / tray.h < prev    next >
C/C++ Source or Header  |  1980-01-03  |  3KB  |  99 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. /*
  24.  * Tray - composes interactors into (possibly) overlapping layouts.
  25.  */
  26.  
  27. #ifndef tray_h
  28. #define tray_h
  29.  
  30. #include <InterViews/scene.h>
  31. #include <InterViews/shape.h>
  32.  
  33. class TrayElement;
  34. class TSolver;
  35.  
  36. class TGlue {
  37. public:
  38.     TGlue(int w = 0, int h = 0, int hstretch = hfil, int vstretch = vfil);
  39.     TGlue(int w, int h, int hshr, int hstr, int vshr, int vstr);
  40.     ~TGlue();
  41.  
  42.     Shape* GetShape();
  43. private:
  44.     Shape* shape;
  45. };
  46.  
  47. class Tray : public Scene {
  48. public:
  49.     Tray(Interactor* background = nil);
  50.     Tray(const char*, Interactor* background = nil);
  51.     Tray(Sensor*, Painter*, Interactor* background = nil);
  52.     ~Tray();
  53.     
  54.     virtual void Draw();
  55.     virtual void Reshape(Shape&);
  56.     virtual void GetComponents(Interactor**, int, Interactor**&, int&);
  57.  
  58.     void Align(Alignment, Interactor*, TGlue* = nil);
  59.     void Align(Alignment, Interactor*, Alignment, Interactor*, TGlue* = nil);
  60.     void Align(
  61.     Alignment, Interactor*, Interactor*,
  62.     Interactor* = nil, Interactor* = nil, Interactor* = nil,
  63.     Interactor* = nil, Interactor* = nil
  64.     );
  65.     void HBox(
  66.     Interactor*, Interactor*,
  67.     Interactor* = nil, Interactor* = nil, Interactor* = nil,
  68.     Interactor* = nil, Interactor* = nil
  69.     );
  70.     void VBox(
  71.     Interactor*, Interactor*,
  72.     Interactor* = nil, Interactor* = nil, Interactor* = nil,
  73.     Interactor* = nil, Interactor* = nil
  74.     );
  75. protected:
  76.     virtual void DoInsert(Interactor*, boolean, Coord& x, Coord& y);
  77.     virtual void DoChange(Interactor*);
  78.     virtual void DoRemove(Interactor*);
  79.     virtual void Reconfig();
  80.     virtual void Resize();
  81. private:
  82.     int nelements;
  83.     TrayElement* head;
  84.     TrayElement* tail;
  85.     Interactor* bg;
  86.     TSolver* tsolver;
  87.  
  88.     void Init(Interactor*);
  89.     void ComponentBounds(int&, int&);
  90.     boolean AlreadyInserted(Interactor*);
  91.     void CalcShape();
  92.     void PlaceElement(TrayElement*);
  93.     boolean TrayOrBg(Interactor*);
  94. };
  95.  
  96. inline Shape* TGlue::GetShape () { return shape; }
  97.  
  98. #endif
  99.